const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const injectControllers = require('./injectControllers') //创建router，并自动注入controllers
const Static = require('koa-static')

const app = new Koa();
app.use(Static(__dirname,'dist'))

app.on('error', async (err) => {//捕获全局错误

  // TODO logger errStack
  console.log(err.errno + ':' + err.sqlMessage);
});

app.use(bodyParser()).use(injectControllers()).listen(3000);